package org.springblade.modules.repair.controller;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springblade.core.tool.api.R;
import org.springblade.modules.repair.dto.statistical.*;
import org.springblade.modules.repair.service.IWorkStatisticalService;
import org.springblade.modules.repair.vo.statistics.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.List;

/**
 * @Description 工单作业统计分析
 * @Author ysq
 * @Date 2022/8/24
 **/
@RestController
@AllArgsConstructor
@RequestMapping("repair/work/statistical")
@Api(value = "工单作业统计分析", tags = "工单作业统计分析")
public class WorkStatisticalController {

	private final IWorkStatisticalService workStatisticalService;

	@PostMapping("/chart/1")
	@ApiOperationSupport(order = 1)
	@ApiOperation(value = "工单日历表")
	public R<List<WorkCalendarVO>> chart1(@Valid @RequestBody WorkCalendarDTO params) {
		return R.data(workStatisticalService.chart1(params));
	}

	@PostMapping("/chart/2")
	@ApiOperationSupport(order = 2)
	@ApiOperation(value = "每日作业明细-维保员")
	public R<List<DayWorkDetailVO>> chart2(@Valid @RequestBody DayWorkDetailDTO params) {
		return R.data(workStatisticalService.chart2(params));
	}

	@PostMapping("/chart/3")
	@ApiOperationSupport(order = 3)
	@ApiOperation(value = "每日作业明细-按组")
	public R<List<DeptDayWorkDetailVO>> chart3(@Valid @RequestBody DeptDayWorkDetailDTO params) {
		return R.data(workStatisticalService.chart3(params));
	}

	@PostMapping("/chart/4")
	@ApiOperationSupport(order = 4)
	@ApiOperation(value = "每日作业明细-按人")
	public R<List<DeptUserWorkDetailVO>> chart4(@Valid @RequestBody DeptUserWorkDetailDTO params) {
		return R.data(workStatisticalService.chart4(params));
	}

	@PostMapping("/chart/5")
	@ApiOperationSupport(order = 5)
	@ApiOperation(value = "作业汇总（数量）-作业时长-维保员")
	public R<PersonalWorkSummaryVO> chart5(@Valid @RequestBody WorkStatisticalDTO params) {
		return R.data(workStatisticalService.chart5(params));
	}

	@PostMapping("/chart/6")
	@ApiOperationSupport(order = 6)
	@ApiOperation(value = "作业汇总（数量）-作业时长-维保组长")
	public R<LeaderWorkSummaryVO> chart6(@Valid @RequestBody WorkStatisticalDTO params) {
		return R.data(workStatisticalService.chart6(params));
	}

	@PostMapping("/chart/7")
	@ApiOperationSupport(order = 7)
	@ApiOperation(value = "作业汇总-整体趋势--作业时长")
	public R<List<WorkTrendChartVO>> chart7(@Valid @RequestBody WorkStatisticalDTO params) {
		return R.data(workStatisticalService.chart7(params));
	}

	@PostMapping("/chart/8")
	@ApiOperationSupport(order = 8)
	@ApiOperation(value = "作业汇总-趋势对比--作业时长-按人")
	public R<List<WorkTrendChartVO>> chart8(@Valid @RequestBody WorkStatisticalDTO params) {
		return R.data(workStatisticalService.chart8(params));
	}

	@PostMapping("/chart/9")
	@ApiOperationSupport(order = 9)
	@ApiOperation(value = "作业汇总-趋势对比--作业时长-按组")
	public R<List<WorkTrendChartVO>> chart9(@Valid @RequestBody WorkGroupStatisticalDTO params) {
		return R.data(workStatisticalService.chart9(params));
	}

	@PostMapping("/chart/10")
	@ApiOperationSupport(order = 10)
	@ApiOperation(value = "作业汇总-作业工单")
	public R<List<WorkPieChartVO>> chart10(@Valid @RequestBody WorkStatisticalDTO params) {
		return R.data(workStatisticalService.chart10(params));
	}

	@PostMapping("/chart/11")
	@ApiOperationSupport(order = 11)
	@ApiOperation(value = "作业汇总-作业工单明细-按组")
	public R<List<WorkOrderDetailVO>> chart11(@Valid @RequestBody WorkGroupStatisticalDTO params) {
		return R.data(workStatisticalService.chart11(params));
	}

	@PostMapping("/chart/12")
	@ApiOperationSupport(order = 12)
	@ApiOperation(value = "作业汇总-作业工单明细-按人")
	public R<List<WorkOrderDetailVO>> chart12(@Valid @RequestBody WorkStatisticalDTO params) {
		return R.data(workStatisticalService.chart12(params));
	}

	@PostMapping("/chart/13")
	@ApiOperationSupport(order = 13)
	@ApiOperation(value = "作业汇总-整体趋势--作业工单")
	public R<List<WorkTrendChartVO>> chart13(@Valid @RequestBody WorkStatisticalDTO params) {
		return R.data(workStatisticalService.chart13(params));
	}

	@PostMapping("/chart/14")
	@ApiOperationSupport(order = 14)
	@ApiOperation(value = "作业汇总-趋势对比--作业工单-按人")
	public R<List<WorkTrendChartVO>> chart14(@Valid @RequestBody WorkStatisticalDTO params) {
		return R.data(workStatisticalService.chart14(params));
	}

	@PostMapping("/chart/15")
	@ApiOperationSupport(order = 15)
	@ApiOperation(value = "作业汇总-趋势对比--作业工单-按组")
	public R<List<WorkTrendChartVO>> chart15(@Valid @RequestBody WorkGroupStatisticalDTO params) {
		return R.data(workStatisticalService.chart15(params));
	}

	@PostMapping("/chart/16")
	@ApiOperationSupport(order = 16)
	@ApiOperation(value = "作业汇总-作业时长明细-按组")
	public R<List<DeptWorkTimeDetailVO>> chart16(@Valid @RequestBody WorkGroupStatisticalDTO params) {
		return R.data(workStatisticalService.chart16(params));
	}

	@PostMapping("/chart/17")
	@ApiOperationSupport(order = 17)
	@ApiOperation(value = "作业汇总-作业时长明细-按人")
	public R<List<WorkTimeDetailVO>> chart17(@Valid @RequestBody WorkStatisticalDTO params) {
		return R.data(workStatisticalService.chart17(params));
	}

}
